package main

import (
	"log"
	"net"
	"time"
)

func main() {
	laddr := net.UDPAddr{
		IP:   net.IPv4(192, 168, 20, 138),
		Port: 3100,
	}
	raddr := net.UDPAddr{
		IP:   net.IPv4(192, 168, 20, 138),
		Port: 3200,
	}
	conn, err := net.DialUDP("udp4", &laddr, &raddr)
	if err != nil {
		log.Println("err", err)
	}
	for {
		log.Println("send...")
		if err != nil {
			log.Println("err", err)
			time.Sleep(time.Second)
			continue
		}
		conn.Write([]byte("hello udp, I'm broadcast to one"))
		time.Sleep(time.Second)
	}
	conn.Close()
}
